def quick_sort(nums,low,high):
    if low >= high:
        return list
    pivot = nums[low]
    start = low
    end = high
    while low < high:
        while pivot <= nums[high] and low < high:
            high -=1
        nums[low] =nums[high]
        while nums[low] <= pivot and low < high:
            low +=1
        nums[high] = nums[low]

    nums[high] = pivot

    quick_sort(nums,start,low-1)
    quick_sort(nums,low+1,end)

    return nums

if __name__=="__main__":
    nums = [2,4,7,9,3,5,2]
    print(quick_sort(nums,0,len(nums)-1))
